﻿using furion.blog.Domain.MySQL;
using furion.blog.Domain.Query.Member;
using furion.blog.Domain.Shared;
using furion.blog.Domain.Shared.Dto.Member;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace furion.blog.Domain.IRepositories
{
    public interface IMemberRepository
    {
        /// <summary>
        /// 查找
        /// </summary>
        /// <param name="exp"></param>
        /// <returns></returns>
        Task<Member> First(Expression<Func<furion.blog.Domain.MySQL.Member, bool>> exp);

        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="member"></param>
        /// <returns></returns>
        Task<bool> Save(Member member);

        /// <summary>
        /// 分页
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        Task<PageVO> List(MemberListQuery query);

        /// <summary>
        /// 更新会员地理位置信息
        /// </summary>
        /// <param name="memberId"></param>
        /// <param name="location"></param>
        /// <returns></returns>
        Task UpdateLocation(long memberId, string location);

        /// <summary>
        /// 通过ID查找实体
        /// </summary>
        /// <param name="memberId"></param>
        /// <returns></returns>
        Task<Member> FindById(long memberId);

        /// <summary>
        /// 通过手机号码查找
        /// </summary>
        /// <param name="phone"></param>
        /// <returns></returns>
        Task<Member> FindByPhone(string phone);

        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        Task UpdateProfile(MemberProfileUpdateDto dto);

        /// <summary>
        /// 更新手机号码
        /// </summary>
        /// <param name="memberId"></param>
        /// <param name="phone"></param>
        /// <returns></returns>
        Task<bool> UpdatePhone(long memberId,string phone);
    }
}
